-
Notifications
You must be signed in to change notification settings - Fork 48
Leaves - Natalie Tapias #27
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
…ethod to make the test pass.
…nd method. Still working on it but saving my work here.
…dle negative numbers yet). Added a large number test and modified the method to make it pass.
CheezItMan
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work, you hit all the learning goals here! Well done.
| until num == 0 | ||
| modulo = (num % 2).to_s | ||
| num /= 2 | ||
| binary_number = modulo+binary_number |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Clever use of string concatenation to reverse things.
| def binary_to_decimal(binary_array) | ||
| raise NotImplementedError | ||
| decimal = 0 | ||
| exponent = 7 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor: I suggest making 7 a constant or binary_array.length - 1 to avoid hardcoding in specific numbers.
Binary and Decimal
Congratulations! You're submitting your assignment.